<!DOCTYPE html>
<html>

	<head lang="en">
		<title>骡窝日报</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<script src="/js/bootstrap/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
		<script src="/js/jquery/jquery.min.js"></script>
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
		<link rel="stylesheet" href="/css/reset.css" />
		<link rel="stylesheet" href="/css/news.css" />
		<script src="/js/plugins/jrender/jrender.min.js"></script>
		<script src="/js/common.js"></script>
		<script src="../js/plugins/dialog2/dialog.min.js"></script>
		<link rel="stylesheet" href="../js/plugins/dialog2/dialog.css">
		<link rel="stylesheet" href="/css/userTravels.css"/>

	</head>

	<script>
		$(function () {
            //拿到登录的用户信息
            var user=JSON.parse(sessionStorage.getItem("user"));
            var userId=user.id;

            var pages = 1;
            var currentPage = 1;
            var temp = [];
            function query() {
                $.get("/dailies/collection",{pageSize:5,currentPage:currentPage,userId:userId,orderBy:"collectionTime desc"},function (data) {
                    console.log(data);
                     $.merge(temp,data.list);
                     $("#daily").renderValues({list:temp},{
                         setHref:function (item,value) {
                             var href = $(item).attr("href")+value;
                             $(item).attr("href",href);
                         }
                     });
                    currentPage += 1;
                    pages = data.pages;
                });
            }

            function scroll() {
                $(window).scroll(function () {
                    if ($(window).height() + $(window).scrollTop()+1 >= $(document).height()) {
                        if (currentPage <= pages) {
                            query();
                        } else {
                            $(document).dialog({
                                type : 'notice',
                                infoText: '我是个有底线的人!',
                                autoClose: 2500,
                                position: 'bottom'  // center: 居中; bottom: 底部
                            });
                        }
                    }
                })
            };
            query();
            scroll();
        })
	</script>
	<body>


	<div class="search-head">
		<div class="row nav-search">
			<div class="col">
				<a href="/mine/collection.html">
					<span><i class="fa fa-chevron-left"></i></span>
				</a>
			</div>
			<div class="col">
				<span>日报</span>
			</div>
			<div class="col"></div>
		</div>
	</div>

		<div class="container news">
			<div class="news">
				<h6 class="news-title">骡窝日报 </h6>
				<div class="row" id="daily">
					<div  render-loop="list">
						<div class="col-7">
							<a href="/mine/newsContent.html?id=" render-fun="setHref" render-key="list.id">
								<img class="rounded" width="170%" height="150px"  render-src="list.coverUrl">
							</a>
								<div class="caption">
									<p render-html="list.title"></p>
								</div>
						</div>
					</div>
				</div>
			</div>
		</div>



</body>
</html>